<template>
	<view class="content">
		<form @submit="search" @reset="reset">
			<view class="search_box">
				<view class="search_box_search">
					<view class="input_box">
						<img src="../../static/image/minejijian_icon_sousuo@2x.png" alt="">
						<input type="text" name="search_input" v-model="search_input" placeholder="请输入批次号" placeholder-style="color: #999999">
					</view>
					<button class="search_btn" form-type="submit">查找</button>
				</view>
			</view>
		</form>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				token: '',
				log_state: false,
				search_input: '',
			}
		},
		onLoad() {
			uni.getStorage({
				key:'token',
				success: res => {
					this.token = res.data
				},
				fail: res => {
					uni.redirectTo({
						url: '../login/login'
					})
				}
			})
		},
		methods: {
			search(e) {
				if ((e.detail.value.search_input == '') || (e.detail.value.search_input == ' ')) {
					return false
				}
				this.search_input = e.detail.value.search_input
				// 跳转搜索扫码结果页面
				uni.navigateTo({
					url: `../batchCollectResult/batchCollectResult?code=${e.detail.value.search_input}`
				})
			},
		}
	}
</script>

<style>
	.content {
		height: 100%;
		width: 100%;
		overflow-x: hidden;
	}
	.search_box {
		width: calc(100% - 48rpx);
		margin-left: 24rpx;
		margin-top: 24rpx;
		border-radius: 12rpx;
		background: #ffffff;
		height: 128rpx;
	}
	.input_box {
		display: flex;
		background: #eeeeee;
		border-radius: 12rpx;
		width: 500rpx;
		height: 80rpx;
		align-items: center;
	}
	.input_box img {
		width: 32rpx;
		height: 32rpx;
		margin-left: 24rpx;
		margin-right: 24rpx;
	}

	.search_box_search {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: calc(100% - 48rpx);
		margin-left: 24rpx;
		height: 100%;
	}

	.search_btn {
		width: 130rpx;
		height: 80rpx;
		background-color: #13A684;
		color: #ffffff;
		border-radius: 12rpx;
		font-size: 32rpx;
		border: none;
		margin: 0;
	}
</style>
